package de.poketradeshop.ui.model;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@SessionScoped
public class CustomerSession implements Serializable {

	//shows if customer is logged in (1) or off(0)
	private int loggedIn = 0;
	
	private String customerName;
	private int customerId;
	private boolean isAdmin;

	public String logOut() {

		loggedIn = 0;
		customerName = "";
		this.customerId = 0;
		return "";
	}

	public String logIn(String customerName, int customerId, boolean isAdmin) {

		if (isAdmin) {
			loggedIn = 2;
		} else {
			loggedIn = 1;
		}
		
		this.customerName = customerName;
		this.customerId = customerId;
		return "index";
	}
	
	public int getLoggedIn() {
		return loggedIn;
	}

	public void setLoggedIn(int loggedIn) {
		this.loggedIn = loggedIn;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public int getCustomerId() {
		return customerId;
	}

	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	public boolean isAdmin() {
		return isAdmin;
	}

	public void setAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}

}
